package com.shicheng.alertdialogmanager;

import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;

import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import com.shicheng.alerts.callback.AlertDialogCallback;
import com.shicheng.alerts.AlertDialogManager;
import com.shicheng.alerts.callback.AlertDialogimpl;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ArrayList<String> strings = new ArrayList<>();
        strings.add("item1");
        strings.add("item2");
        findViewById(R.id.alert_bt).setOnClickListener(new View.OnClickListener() {
            @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
            @Override
            public void onClick(View v) {
                AlertDialogManager.builder()
                        .setContext(MainActivity.this)
                        .setType(1)
                        .setNegativeButton("取消")
                        .setBottomLists(strings)
                        .setBottomItemCallback(new AlertDialogimpl() {
                            @Override
                            public void Success(int i, String s) {
                                super.Success(i, s);
                                Toast.makeText(MainActivity.this, i+"==="+s, Toast.LENGTH_SHORT).show();
                            }
                        })
                        .show();
            }
        });

    }
}